<template>
	<view>
		<!-- 导航栏 -->
		<view class="nav-bar">
			<view class="nav-left" @click="goBack">
				<text class="nav-back-icon">&lt;</text>
			</view>
			<view class="nav-title">活动管理</view>
			<view class="nav-right">
				<text class="nav-icon">⋯</text>
				<text class="nav-divider">|</text>
				<text class="nav-icon">⊙</text>
			</view>
		</view>
		
		<view class="page">
			<!-- 蓝色背景区域 -->
			<view class="blue-background"></view>
		
		<!-- 主内容容器 -->
		<view class="main-content">
			<!-- 活动管理内容 -->
			<view class="activity-management">
				<!-- 标签页 -->
				<view class="tab-container">
					<view class="tab-item" :class="{ active: activeTab === 'on' }" @click="switchTab('on')">
						<text class="tab-text">已上架</text>
					</view>
					<view class="tab-item" :class="{ active: activeTab === 'off' }" @click="switchTab('off')">
						<text class="tab-text">未上架</text>
					</view>
				</view>
				
				<!-- 活动列表 -->
				<view class="activity-list">
					<!-- 已上架列表 -->
					<view v-if="activeTab === 'on'" class="activity-item" v-for="(item, index) in onShelfList" :key="index">
						<view class="activity-content">
							<text class="activity-title">阳春三月油江南活动开始报名了</text>
							<text class="activity-date">2023-03-10 11:09</text>
						</view>
						<view class="activity-action">
							<view class="action-button">下架</view>
						</view>
					</view>
					
					<!-- 未上架列表 -->
					<view v-if="activeTab === 'off'" class="activity-item" v-for="(item, index) in offShelfList" :key="index">
						<view class="activity-content">
							<text class="activity-title">阳春三月油江南活动开始报名了</text>
							<view class="status-row">
								<text class="activity-status" :class="item.statusClass">{{ item.status }}</text>
								<text class="activity-date">2023-03-10 11:09</text>
							</view>
						</view>
						<view class="activity-action">
							<view class="action-button">{{ item.action }}</view>
						</view>
					</view>
				</view>
			</view>
			
			<!-- 底部按钮 -->
			<view class="bottom-button">
				<view class="publish-button" @click="goToPublishUpload">
					<text class="button-text">+ 发布活动</text>
				</view>
			</view>
		</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				activeTab: 'on', // 默认选中已上架
				onShelfList: [
					{ title: "阳春三月油江南活动开始报名了", date: "2023-03-10 11:09" },
					{ title: "阳春三月油江南活动开始报名了", date: "2023-03-10 11:09" }
				],
				offShelfList: [
					{ status: "审核中", statusClass: "status-reviewing", action: "删除" },
					{ status: "审核成功", statusClass: "status-success", action: "上架" },
					{ status: "审核失败", statusClass: "status-failed", action: "删除" }
				]
			}
		},
		methods: {
			// 返回上一页
			goBack() {
				uni.navigateBack();
			},
			switchTab(tab) {
				this.activeTab = tab;
				console.log('切换到标签:', tab);
			},
			// 跳转到发布活动上传页面
			goToPublishUpload() {
				uni.navigateTo({
					url: '/fk/EventPublishUpload/index'
				});
			}
		}
	}
</script>

<style>
	/* 导航栏样式 */
	.nav-bar {
		height: 120rpx;
		background: #1f78ff;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 32rpx;
		z-index: 1000;
		box-sizing: border-box;
	}

	.nav-left {
		width: 60rpx;
		height: 60rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		transition: all 0.3s ease;
	}

	.nav-left:active {
		transform: scale(0.95);
	}

	.nav-back-icon {
		color: #ffffff;
		font-size: 60rpx;
		font-weight: 200;
		line-height: 1;
	}

	.nav-title {
		color: #ffffff;
		font-size: 32rpx;
		font-weight: 500;
		padding-left: 40rpx;
		flex: 1;
		text-align: center;
	}

	.nav-right {
		display: flex;
		align-items: center;
		background: rgba(1, 1, 1, 0.2);
		border-radius: 50rpx;
		padding: 10rpx 20rpx;
		gap: 16rpx;
	}

	.nav-icon {
		color: #ffffff;
		font-size: 32rpx;
		font-weight: 600;
	}

	.nav-divider {
		color: #ffffff;
		font-size: 20rpx;
		opacity: 0.8;
	}

	.page {
		background-color: #f5f6fa;
		min-height: 100vh;
		position: relative;
		padding-top: 120rpx; /* 为固定导航栏留出空间 */
	}
	
	/* 蓝色背景区域 */
	.blue-background {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 200rpx;
		background: linear-gradient(120deg, #1f78ff 0%, #2f89ff 100%);
	}
	
	/* 主内容容器 */
	.main-content {
		position: absolute;
		top: 20rpx; /* 调整位置，考虑导航栏高度 */
		left: 50%;
		transform: translateX(-50%);
		width: 94%;
		max-width: 750rpx;
		z-index: 10;
		padding: 20rpx 0;
	}
	
	/* 活动管理内容 */
	.activity-management {
		background: #ffffff;
		border-radius: 20rpx;
		padding: 0;
		box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.1);
		overflow: hidden;
	}
	
	/* 标签页 */
	.tab-container {
		display: flex;
		padding: 30rpx 30rpx 0;
		justify-content: center;
	}
	
	.tab-item {
		padding: 16rpx 32rpx;
		background: #f0f0f0;
		position: relative;
	}
	
	.tab-item:first-child {
		border-radius: 20rpx 0 0 20rpx;
	}
	
	.tab-item:last-child {
		border-radius: 0 20rpx 20rpx 0;
	}
	
	.tab-item.active {
		background: #1f78ff;
	}
	
	.tab-text {
		font-size: 28rpx;
		color: #666666;
	}
	
	.tab-item.active .tab-text {
		color: #ffffff;
		font-weight: 500;
	}
	
	/* 活动列表 */
	.activity-list {
		padding: 30rpx;
	}
	
	.activity-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 30rpx 0;
		border-bottom: 1rpx solid #f0f0f0;
	}
	
	.activity-item:last-child {
		border-bottom: none;
	}
	
	.activity-content {
		flex: 1;
		margin-right: 20rpx;
	}
	
	.activity-title {
		font-size: 30rpx;
		color: #333333;
		line-height: 1.4;
		margin-bottom: 10rpx;
		display: block;
	}
	
	.activity-date {
		font-size: 24rpx;
		color: #999999;
		display: block;
	}
	
	/* 状态行 */
	.status-row {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 10rpx;
	}
	
	/* 活动状态 */
	.activity-status {
		font-size: 24rpx;
		font-weight: 500;
	}
	
	.status-reviewing {
		color: #ff4444;
	}
	
	.status-success {
		color: #00aa00;
	}
	
	.status-failed {
		color: #c4c4c4;
	}
	
	.activity-action {
		flex-shrink: 0;

	}
	
	.action-button {
		background: #1f78ff;
		color: #ffffff;
		font-size: 24rpx;
		width: 100rpx;
		height: 40rpx;
		padding: 12rpx 24rpx;
		border-radius: 50rpx;
		text-align: center;
	}
	
	/* 底部按钮 */
	.bottom-button {
		margin-top: 50rpx;
		display: flex;
		justify-content: center;
	}
	
	.publish-button {
		background: #1f78ff;
		border-radius: 50rpx;
		padding: 24rpx 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		min-width: 400rpx;
		height: 30rpx;
		box-shadow: 0 4rpx 12rpx rgba(31, 120, 255, 0.3);
	}
	
	.button-text {
		color: #ffffff;
		font-size: 32rpx;
		font-weight: 500;
	}
</style>